Skip to main content
Version: 1.0.0

Scatterplot Matrix

Displays a grid of scatterplots to visualize the pairwise relationships between multiple variables. This allows for a comprehensive exploration of the relationships between all pairs of variables in the dataset, helping to identify potential correlations, clusters, and outliers.

Chart:


Code:

  const { muze, getDataFromSearchQuery } = viz;
  
  const data = getDataFromSearchQuery();

  const Fields = ["Miles_per_Gallon", "Acceleration", "Horsepower"];
  const ColorField = "Origin";

  muze
    .canvas()
    .columns(Fields)
    .rows(Fields.slice().reverse())
    .layers([
      {
        mark: "point",
        encoding: {
          color: ColorField,
        },
      },
    ])
    .config({
      autoGroupBy: {
        disabled: true,
      },
      axes: {
        x: {
          numberOfTicks: 5,
        },
        y: {
          numberOfTicks: 5,
        },
      },
      gridLines: {
        y: {
          show: true,
        },
        x: {
          show: true,
        },
        zeroLineColor: "#FFFFFF",
      },
      legend: {
        color: {
          range: ["#BC80BD", "#CCEBC5", "#FFED6F"],
        },
      },
    })
    .data(data)
    .mount("#chart"); // mount your chart